// JavaScript Document
LogCalendar = new Function();

LogCalendar.prototype.TOTAL_HOURS = 24;
LogCalendar.prototype.ONE_HOUR = 60;
LogCalendar.prototype.timeInterval;
LogCalendar.prototype.actualDate = new Date();


LogCalendar.prototype.setTimeInterval = function(timeInterval){
	this.timeInterval = timeInterval;
}

LogCalendar.prototype.getTimeInterval = function(){
	return this.timeInterval;
}

LogCalendar.prototype.setActualDate = function(actualDate){
	this.actualDate = actualDate;
}

LogCalendar.prototype.getActualDateString = function(){
	var dateString = new String();
	dateString += this.actualDate.getDay();
	dateString += "/" + this.actualDate.getMonth();
	dateString += "/" + this.actualDate.getYear();
	return dateString;
}

LogCalendar.prototype.showCalendar = function(){
	function getDateString(actualHour, actualMinutes){
		var dateString = new String();
		if(actualHour <= 9){
			dateString += "0" + actualHour + ":";
		}else{
			dateString += actualHour + ":";
		}
		if(actualMinutes <= 9){
			dateString += "0" + actualMinutes;
		}else{
			dateString += actualMinutes;
		}
		return dateString;
	}
	
		var totalIntervals = this.TOTAL_HOURS * this.ONE_HOUR;
		totalIntervals = totalIntervals / this.getTimeInterval();
		document.write("<table>");
		document.write("<tr><td colspan=\"2\">Registry Log</td></tr>");
		document.write("<tr><td colspan=\"2\">" + this.getActualDateString() + "</td></tr>");
		document.write("<tr><td>Hour</td><td>Location</td></tr>");
		var actualHour = 0;
		var actualMinutes = -30;
		for(i=0;i<=totalIntervals;i++){
			document.write("<tr>");
			document.write("<td>");
			actualMinutes += 30;
			if(actualMinutes >= this.ONE_HOUR){
				actualMinutes = actualMinutes - this.ONE_HOUR;
				actualHour++;
			}
			document.write(getDateString(actualHour,actualMinutes));
			document.write("</td>");
			document.write("</tr>");
		}
		document.write("</table>");
}


